import os
from building import *

cwd = GetCurrentDir()

Import('asenv')
ASROOT = asenv['ASROOT']
target = asenv['target']
BDIR = asenv['BDIR']
MODULES = asenv['MODULES']

objs = SConscript('app/SConscript')
if('SG' in MODULES):
    objs += SConscript('SgDesign/SConscript')

try:
    if(IsPlatformWindows()):target += '.exe'
    action = '%s %s %s.s19'%(asenv['S19'],target,target)
    asenv['POSTACTION'].append(action)
    pys19 = '%s %s/com/as.tool/as.one.py/pyas/s19.py'%(asenv['python3'],ASROOT)
    ASBOOT = os.path.abspath('%s/../asboot'%(BDIR))
    action = '%s -c %s.s19 -o %s/app_s19.c'%(pys19,target,ASBOOT)
    asenv['POSTACTION'].append(action)
except KeyError:
    pass

SConscript('elf/SConscript')

Return('objs')

